package com.arvato.minipro.controller.front.mall;


import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.arvato.minipro.bean.bean_dto.common.PageData;
import com.arvato.minipro.bean.bean_dto.common.Query;
import com.arvato.minipro.bean.bean_dto.common.Result;
import com.arvato.minipro.bean.bean_vo.mall.EcStoreVo;
import com.arvato.minipro.service.mall.StoreService;

/**
 * 
 * @author: smallking
 * 
 * @Descibe:用户收货地址Controller
 * 
 * @Date: 2018年5月8日  上午11:24:50
 */
@Controller
@RequestMapping(value = "/mall/store")
public class StoreController {
	
	@Autowired
	private StoreService storeService;
	
	/**
	 * 按照条件查询门店
	 * @param req
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/list", method = {RequestMethod.POST})
	public PageData list(HttpServletRequest req, @RequestParam Map<String, Object> param) {
		Query query = new Query(param);
		PageData data = storeService.listStoreByQuery(query);
		data.setFront(true);
		return data;
	}
	
	/**
	 * 根据ID查询门店
	 * @param req
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/detail", method = {RequestMethod.POST})
	public Result detail(HttpServletRequest req, String storeId) {
		Result result = new Result(true);
		EcStoreVo storeVo = storeService.getStoreById(storeId);
		result.setData(storeVo);
		return result;
	}
	
}
